package com.company.Sort;

/**
 * Created by v on 16-12-9.
 */
public class ShellSort<E extends Comparable<E>> {
    public ShellSort(E[] array){
        for(int gap=array.length/2;gap>0;gap/=2){
            for(int i=gap;i<array.length;i++){
                E temp=array[i];

                int j;
                for(j=i;j>=gap
                        &&temp.compareTo(array[j])<0;j-=gap)
                    array[j]=array[j-gap];

                array[j]=temp;
            }
        }
    }
}
